<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ include file="/WEB-INF/views/include/head.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>部门管理</title>
    <%@ include file="/WEB-INF/views/include/tree.jsp" %>
    <script type="text/javascript">
        $(function () {
        })
    </script>
</head>
<body>
<ol class="breadcrumb">
    <li><a href="#">资源管理</a></li>
    <li><a href="#">基础信息</a></li>
    <li class="active"><a href="#">部门管理</a></li>
</ol>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/resource/basic/department/">部门列表</a></li>
    <shiro:hasPermission name="basic:department:edit"><li class="active"><a href="${ctx}/resource/basic/department/form" >${not empty department.id?'修改部门':'添加部门'}</a></li> </shiro:hasPermission>
</ul>
<div class="header">
    <div id="messageBox" class="alert alert-warning ${empty message ? 'hide' : ''}"><button data-dismiss="alert" class="close">×</button>
        <label id="loginError" class="error">${message}</label>
    </div>
</div>
<div class="container" style="margin-top: 30px">
    <form class="form-horizontal" modelattribute="department" action="${ctx}/resource/basic/department/save" method="post">
        <fieldset>
            <div class="form-group">
                <label for="name" class="col-md-2 control-label">部门名称</label>
                <div class="col-md-5">
                    <input class="form-control" id="name" name="name" placeholder="部门名称" type="text" value="${department.name}">
                    <input class="form-control hidden" id="id" name="id"  type="text" value="${department.id}">
                </div>
            </div>
            <div class="form-group">
                <label for="code" class="col-md-2 control-label">部门代码</label>
                <div class="col-md-5">
                    <input class="form-control" id="code" name="code"  placeholder="部门代码" type="text" value="${department.code}">
                </div>
            </div>
            <div class="form-group">
                <label for="labelName" class="col-md-2 control-label">上级部门</label>
                <div class="col-md-5">
                    <input class="form-control" id="labelName"    placeholder="上级部门" type="text" value="${department.parent.name}" onclick="treeSelect('/resource/basic/department/treeData','上级区域')">
                    <input style="display: none" class="form-control" id="labelId" name="parent.id"  placeholder="上级部门" type="text" value="${department.parent.id}">
                </div>
            </div>
            <div class="form-group">
                <label for="description" class="col-md-2 control-label">部门描述</label>
                <div class="col-md-5">
                    <textarea class="form-control" rows="3" id="description" name="description">${department.description}</textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-10 col-md-offset-2">
                    <button type="reset" class="btn btn-default" onclick="history.go(-1)">取消</button>
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </div>
        </fieldset>
    </form>
</div>

</body>
</html>